Discover gists
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this GIST is a follow-up to this previous GIST: https://gist.github.com/morgangiraud/ffa45e76b6891cd4e37e90d75b8be37b | |
# See the article here: https://morgangiraud.medium.com/multi-gpu-nvidia-p2p-capabilities-and-debugging-tips-fb7597b4e2b5 | |
# It provides some tips and tricks to install Tinygrad patched nvidia open kernel to give P2P capabilities | |
# to the 40** series! | |
### Transitioning into complex operations, our aim is to minimize potential issues. | |
### Important: Verify that the version from nvidia-smi matches exactly what we intend to use. | |
### At the time of this writing, the reported version is 550.78. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
impl Solution { | |
pub fn is_palindrome(x: i32) -> bool { | |
if x < 0 { | |
return false; | |
} | |
let mut x_copy = x; | |
let mut reverse: i32 = 0; | |
while x_copy > 0 { | |
reverse = (reverse * 10) + (x_copy % 10); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Script for Ubuntu: Nvidia Multi-GPU Installation and Testing (Adaptable for other distros) | |
# Step 0: Clean Nvidia Installation | |
# If you need to completely remove a previous Nvidia installation, use these commands. | |
# This ensures that you start with a clean slate for a new installation. | |
sudo apt-get --purge remove "*nvidia*" | |
sudo apt-get --purge remove "*cuda*" "*cudnn*" "*cublas*" "*cufft*" "*cufile*" "*curand*" "*cusolver*" "*cusparse*" "*gds-tools*" "*npp*" "*nvjpeg*" "nsight*" "*nvvm*" "*libnccl*" | |
# Verify that the removal is complete by checking if any Nvidia, CUDA, or cuDNN packages are still installed. | |
apt list --installed | grep cuda |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Source: http://codereview.stackexchange.com/questions/95464/is-the-copy-swap-idiom-implemented-here-correctly | |
class Array | |
{ | |
int size; | |
int* data; | |
public: | |
Array(Array const& copy) | |
: size(copy.size) | |
, data(new int[size]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# setup dbus | |
if test -z "$DBUS_SESSION_BUS_ADDRESS"; then | |
eval $(dbus-launch --exit-with-session --sh-syntax) | |
fi | |
systemctl --user import-environment DISPLAY XAUTHORITY | |
if command -v dbus-update-activation-environment >/dev/null 2>&1; then | |
dbus-update-activation-environment DISPLAY XAUTHORITY | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-------------------------------------------------------------------------------- | |
-- Batched Yield-Safe Signal Implementation -- | |
-- This is a Signal class which has effectively identical behavior to a -- | |
-- normal RBXScriptSignal, with the only difference being a couple extra -- | |
-- stack frames at the bottom of the stack trace when an error is thrown. -- | |
-- This implementation caches runner coroutines, so the ability to yield in -- | |
-- the signal handlers comes at minimal extra cost over a naive signal -- | |
-- implementation that either always or never spawns a thread. -- | |
-- -- | |
-- API: -- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
-webkit-text-size-adjust: none; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tiktoken | |
import langdetect | |
T = tiktoken.get_encoding("o200k_base") | |
length_dict = {} | |
for i in range(T.n_vocab): | |
try: | |
length_dict[i] = len(T.decode([i])) | |
except: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Windows Registry Editor Version 5.00 | |
[HKEY_CLASSES_ROOT\VLC.mp4\shell\Open\command] | |
@="\"C:\\Program Files\\VideoLAN\\VLC\\vlc.exe\" --started-from-file --sout-all --sout \"#display\" \"%1\"" | |
NewerOlder